/*
 *  IOReturnErrorLookUp.h
 *  MusicAnalyzer
 *
 *  Created by jiro on 12/03/27.
 *  Copyright 2012 jiro music. All rights reserved.
 *
 */

#pragma once

#include <string>
#include "IOKit/IOKitLib.h"

namespace sc
{
	class IOReturnErrorLookUp
	{
	public:
		static std::string GetMeesage( long long int errorCode )
		{
			switch ( errorCode ) {
			case kIOReturnSuccess: return "OK";
			case kIOReturnError: return "general error";
			case kIOReturnNoMemory: return "can't allocate memory";
			case kIOReturnNoResources: return "resource shortage";
			case kIOReturnIPCError: return "error during IPC";
			case kIOReturnNoDevice: return "no such device";
			case kIOReturnNotPrivileged: return "privilege violation";
			case kIOReturnBadArgument: return "invalid argument";
			case kIOReturnLockedRead: return "device read locked";
			case kIOReturnLockedWrite: return "device write locked";
			case kIOReturnExclusiveAccess: return "exclusive access and device already open";
			case kIOReturnBadMessageID: return "sent/received messages had different msg_id";
			case kIOReturnUnsupported: return "unsupported function";
			case kIOReturnVMError: return "misc. VM failure";
			case kIOReturnInternalError: return "internal error";
			case kIOReturnIOError: return "General I/O error";
			case kIOReturnCannotLock: return "can't acquire lock";
			case kIOReturnNotOpen: return "device not open";
			case kIOReturnNotReadable: return "read not supported";
			case kIOReturnNotWritable: return "write not supported";
			case kIOReturnNotAligned: return "alignment error";
			case kIOReturnBadMedia: return "Media Error";
			case kIOReturnStillOpen: return "device(s) still open";
			case kIOReturnRLDError: return "rld failure";
			case kIOReturnDMAError: return "DMA failure";
			case kIOReturnBusy: return "Device Busy";
			case kIOReturnTimeout: return "I/O Timeout";
			case kIOReturnOffline: return "device offline";
			case kIOReturnNotReady: return "not ready";
			case kIOReturnNotAttached: return "device not attached";
			case kIOReturnNoChannels: return "no DMA channels left";
			case kIOReturnNoSpace: return "no space for data";
			case kIOReturnPortExists: return "port already exists";
			case kIOReturnCannotWire: return "can't wire down physical memory";
			case kIOReturnNoInterrupt: return "no interrupt attached";
			case kIOReturnNoFrames: return "no DMA frames enqueued";
			case kIOReturnMessageTooLarge: return "oversized msg received on interrupt port";
			case kIOReturnNotPermitted: return "not permitted";
			case kIOReturnNoPower: return "no power to device";
			case kIOReturnNoMedia: return "media not present";
			case kIOReturnUnsupportedMode: return "no such mode";
			case kIOReturnUnderrun: return "data underrun";
			case kIOReturnOverrun: return "data overrun";
			case kIOReturnDeviceError: return "the device is not working properly!";
			case kIOReturnNoCompletion: return "a completion routine is required";
			case kIOReturnAborted: return "operation aborted";
			case kIOReturnNoBandwidth: return "bus bandwidth would be exceeded";
			case kIOReturnNotResponding: return "device not responding";
			case kIOReturnIsoTooOld: return "isochronous I/O request for distant past!";
			case kIOReturnIsoTooNew: return "isochronous I/O request for distant future";
			case kIOReturnNotFound: return "data was not found";
			case kIOReturnInvalid: return "should never be seen";
			default: return "unknown error";
			}
		}
	};
}
